const express = require('express');
const cors = require('cors');
const userRoutes = require('./routes/userRoutes');
const goodsRoutes = require('./routes/goodsRoutes');

const app = express();

// 中间件
app.use(cors()); // 解决跨域
app.use(express.json()); // 解析 JSON 请求

// 路由
app.use('/api', userRoutes);
app.use('/api', goodsRoutes);

// 启动服务
const PORT = 3000;
app.listen(PORT, () => {
    console.log(`Server running on http://localhost:${PORT}`);
});
